s = input()
word = 'lan'
# 不同的子序列
dp = [[0 for _ in range(4)] for _ in range(len(s) + 1)]
for i in range(len(s) + 1):
    dp[i][0] = 1
for i in range(1, len(s) + 1):
    for j in range(1, 4):
        if s[i - 1] == word[j - 1]:
            dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j])
        else:
            dp[i][j] = dp[i - 1][j]
print(dp[-1][-1])
